package com.JingYan.Thread;

import lombok.extern.slf4j.Slf4j;

/**
 * 中断线程需要的测试线程
 *
 * @author Dong_Jia_Qi on 2022/6/4
 */
@Slf4j
public class InterruptBTread extends Thread {
    public InterruptBTread() {
    }

    public InterruptBTread(Runnable target) {
        super(target);
    }

    public InterruptBTread(ThreadGroup group, Runnable target) {
        super(group, target);
    }

    public InterruptBTread(String name) {
        super(name);
    }

    public InterruptBTread(ThreadGroup group, String name) {
        super(group, name);
    }

    public InterruptBTread(Runnable target, String name) {
        super(target, name);
    }

    public InterruptBTread(ThreadGroup group, Runnable target, String name) {
        super(group, target, name);
    }

    public InterruptBTread(ThreadGroup group, Runnable target, String name, long stackSize) {
        super(group, target, name, stackSize);
    }

    @Override
    public void run() {
        int n = 1 ;
        while (!isInterrupted()){
            log.info(n++ + "次执行");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                break;
            }
        }
    }
}
